/*=====================================================================================================================
 * 
 * Repository path:     $HeadURL: http://pfsmps.googlecode.com/svn/trunk/src/parlist.c $
 * Last committed:      $Revision: 2 $
 * Last changed by:     $Author: vladislav.gyurov@gmail.com $
 * Last changed date:   $Date: 2013-09-16 20:26:36 +0000 (Mon, 16 Sep 2013) $
 * ID:                  $Id: parlist.c 2 2013-09-16 20:26:36Z vladislav.gyurov@gmail.com $
 *
 *===================================================================================================================*/

/*=====================================================================================================================
 * Body Identification  
 *===================================================================================================================*/
#ifdef __PARLIST_C
    #error "!!! FileName ID. It should be Unique !!!"
#else
    #define __PARLIST_C
#endif

/*=====================================================================================================================
 * Included files to resolve specific definitions in this file
 *===================================================================================================================*/
#include "parlist.h"
#include "singleshot.h"
#include "vadc.h"
#include "measure.h"


/*=====================================================================================================================
 * Local constants
 *===================================================================================================================*/

/*=====================================================================================================================
 * Local macros
 *===================================================================================================================*/

/*=====================================================================================================================
 * Local types
 *===================================================================================================================*/

/*=====================================================================================================================
 * Local data
 *===================================================================================================================*/
U16 release = 0xABCD; 

/*=====================================================================================================================
 * Constant Local Data
 *===================================================================================================================*/
const U16 version = FIRMWARE_BASE_VERSION + FIRMWARE_SUB_VERSION;  
const U16 C30_Version = __C30_VERSION__; 

/*=====================================================================================================================
 * Constant exported data                                                     
 *===================================================================================================================*/
const iolist iopar[] =
{
#if SINGLESHOT_USED
/* 
** Single shot parameters 
*/
{1,"SINGLE_SHOT_FLAGS",             (U16 *)&SINGLE_SHOT_FLAGS,		    (U16 *)&SINGLE_SHOT_FLAGS,			    2,"brr",	0xFFFFu ,   0,0,0, 1},
{2,"u16PfcPrimaryChannelPulse",     (U16 *)&u16PfcPrimaryChannelPulse,	(U16 *)&u16PfcPrimaryChannelPulse,      2,"urr",	0xFFFFu ,   0,0,0, 1},
{3,"u16PfcSecondaryChannelPulse",   (U16 *)&u16PfcSecondaryChannelPulse,(U16 *)&u16PfcSecondaryChannelPulse,    2,"urr",	0xFFFFu ,   0,0,0, 1},
{4,"u16Smps_Pulse",                 (U16 *)&u16Smps_Pulse,	            (U16 *)&u16Smps_Pulse,                  2,"urr",	0xFFFFu ,   0,0,0, 1},
{5,"u16PfcShotsNumber",             (U16 *)&u16PfcShotsNumber,	        (U16 *)&u16PfcShotsNumber,              2,"urr",	cPFC_MaxShots,0,0,0, 1},
{6,"u16SmpsShotsNumber",            (U16 *)&u16SmpsShotsNumber,	        (U16 *)&u16SmpsShotsNumber,             2,"urr",	cPFC_MaxShots,0,0,0, 1},
#endif

/*
** Converter feedback
*/
{20,"Temperature",                 (U16 *)&Mes.u16TempFbk_x10,	        (U16 *)&Mes.u16TempFbk_x10,             2,"urr",	0xFFFFu ,   0,5,0, 10},
{21,"SMPS VOUT",                   (U16 *)&Mes.u16SmpsVout_x10,	        (U16 *)&Mes.u16SmpsVout_x10,            2,"urr",	0xFFFFu ,   0,5,0, 10},
{22,"SMPS I H-BRIDGE POS",         (U16 *)&Mes.u16SmpsI_POS_x10,	    (U16 *)&Mes.u16SmpsI_POS_x10,           2,"urr",	0xFFFFu ,   0,5,0, 10},
{23,"PFC V_AC Grid Voltage",       (U16 *)&Mes.u16PfcVac_RMS_x10,	    (U16 *)&Mes.u16PfcVac_RMS_x10,          2,"urr",	0xFFFFu ,   0,5,0, 10},
{24,"PFC V_DC LINK",               (U16 *)&Mes.u16PfcVdc_x10,	        (U16 *)&Mes.u16PfcVdc_x10,              2,"urr",	0xFFFFu ,   0,5,0, 10},
{25,"PFC I_AC Grid Current",       (U16 *)&Mes.u16PfcIac_x10,	        (U16 *)&Mes.u16PfcIac_x10,              2,"urr",	0xFFFFu ,   0,5,0, 10},
{26,"PFC I_T1",                    (U16 *)&Mes.u16PfcIT1_x10,	        (U16 *)&Mes.u16PfcIT1_x10,              2,"urr",	0xFFFFu ,   0,5,0, 10},
{27,"PFC I_T2",                    (U16 *)&Mes.u16PfcIT2_x10,	        (U16 *)&Mes.u16PfcIT2_x10,              2,"urr",	0xFFFFu ,   0,5,0, 10},
{28,"SMPS I H-BRIDGE NEG",         (U16 *)&Mes.u16SmpsI_NEG_x10,	    (U16 *)&Mes.u16SmpsI_NEG_x10,           2,"urr",	0xFFFFu ,   0,5,0, 10},


#ifdef PWM_MODULE_REGISTER_TRACE
{500,"TRIG4",                       (U16 *)&TRIG4,		                (U16 *)&TRIG4,				            2,"urr",	7538u ,     0,0,0, 1},
{501,"STRIG4",                      (U16 *)&STRIG4,		                (U16 *)&STRIG4,				            2,"urr",	7538u ,     0,0,0, 1},
{502,"PDC4",                        (U16 *)&PDC4,		                (U16 *)&PDC4,				            2,"urr",	7538u ,     0,0,0, 1},
{503,"SDC4",                        (U16 *)&SDC4,		                (U16 *)&SDC4,				            2,"urr",	7538u ,     0,0,0, 1},
{504,"PHASE2",                      (U16 *)&PHASE2,		                (U16 *)&PHASE2,				            2,"urr",	3765u,      0,0,0, 1},

#endif
/*
** ADC registers
*/
{520,"SMPS_I_DIR_1_FBK",            (U16 *)&ADCBUF0,                    (U16 *)&ADCBUF0,                        2,"urr",	0xFFFF,     0,5,0, 1},
{521,"SMPS_V_FBK",                  (U16 *)&ADCBUF1,                    (U16 *)&ADCBUF1,                        2,"urr",	0xFFFF,     0,5,0, 1},
{522,"SMPS_I_DIR_2_FBK",            (U16 *)&ADCBUF2,                    (U16 *)&ADCBUF2,                        2,"urr",	0xFFFF,     0,5,0, 1},
{523,"PFC_AC_VOLT_FBK",             (U16 *)&ADCBUF3,                    (U16 *)&ADCBUF3,                        2,"urr",	0xFFFF,     0,5,0, 1},
{524,"PFC_AC_CURRENT_FBK",          (U16 *)&ADCBUF4,                    (U16 *)&ADCBUF4,                        2,"urr",	0xFFFF,     0,5,0, 1},
{525,"PFC_T1_CURRENT_FBK",          (U16 *)&ADCBUF5,                    (U16 *)&ADCBUF5,                        2,"urr",	0xFFFF,     0,5,0, 1},
{526,"PFC_T2_CURRENT_FBK",          (U16 *)&ADCBUF6,                    (U16 *)&ADCBUF6,                        2,"urr",	0xFFFF,     0,5,0, 1},
{527,"PFC_DC_LINK_FBK",             (U16 *)&ADCBUF7,                    (U16 *)&ADCBUF7,                        2,"urr",	0xFFFF,     0,5,0, 1},
{528,"ADC_TEMPEBK",                 (U16 *)&ADCBUF11,                   (U16 *)&ADCBUF11,                       2,"urr",	0xFFFF,     0,5,0, 1},

{995,"Compiled with C30 VERSION",   (U16 *)&C30_Version,		        (U16 *)&C30_Version,					2,"uoo",	65535u ,    0,5,0, 100},
//{996,__TIME__,           			(U16 *)&release,				    (U16 *)&release,				        2,"uoo",	65535u ,    0,5,0, 1},
//{997,__DATE__,           			(U16 *)&release,					(U16 *)&release,					    2,"uoo",	65535u ,    0,5,0, 1}, 
{998,"Release",           		    (U16 *)&release,					(U16 *)&release,					    2,"unr",	65535u ,    0,0,0, 1},
{999,"Version",           		    (U16 *)&version,					(U16 *)&version,					    2,"uoo",	65535u ,    0,5,0, 100},
{  0,"",                  		    NULL,								NULL,							        0,"srr",	0u ,	    0,0,1, 1}
};
/*=====================================================================================================================
 * Exported Data
 *===================================================================================================================*/

/*=====================================================================================================================
 * Local Functions Prototypes
 *===================================================================================================================*/


/*=====================================================================================================================
 *
 *                                  E X P O R T E D    F U N C T I O N S
 *
 *===================================================================================================================*/
/*=====================================================================================================================
 * Parameters: void
 *
 * Return: return number of params in system
 *
 * Description:  Get number of parameters
 *===================================================================================================================*/
U16 IF_Parlist_GetCntMembers(void)
{
    return( sizeof(iopar)/sizeof(iopar[0]) );
}

/*=====================================================================================================================
 * Parameters: void
 *
 * Return: return number bytes
 *
 * Description: Get bytes of "iopar" structure
 *===================================================================================================================*/
U16 IF_Parlist_GetCntBytes(void)
{
    return( sizeof(iopar) );
}

/*=====================================================================================================================
 * Parameters: Parameter number
 *
 * Return: return pointer to desired parameter
 *
 * Description: Get desired param number
 *===================================================================================================================*/
iolist* IF_Parlist_bnu(U16 u16PrmNumber)
{
    iolist* pio;

    // get pointer to current parameter
    for( pio=(iolist*)iopar; (0 != pio->number) && (u16PrmNumber != pio->number); pio++)
        ;
    if(!pio->number)
        return(NULL);
    else
        return(pio);
}

/*=====================================================================================================================
 *                                                                            
 *                                     L O C A L    F U N C T I O N S                   
 *                                                                            
 *===================================================================================================================*/
/*=====================================================================================================================
 * Parameters: void
 *
 * Return: void
 *
 * Description: 
 *===================================================================================================================*/

